package cn.biplam.front.component.view.systemManage.sysprivi.user.manage.role;

import cn.biplam.common.bean.systemManage.privi.UserManageBean;
import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.common.wrapper.KvMap;
import cn.biplam.common.wrapper.UserInfo;
import cn.biplam.front.component.ComponentBase;
import cn.biplam.front.component.view.systemManage.sysprivi.user.UserManage;
import cn.biplam.front.component.view.systemManage.sysprivi.user.manage.list.UserBase;
import cn.biplam.front.html.HtmlDiv;
import cn.biplam.front.html.base.HtmlWindow;
import cn.biplam.front.htmlscript.script.AjxScript;
import cn.biplam.front.template.control.Confirm;

/**
 *  删除用户角色
 * @author XiaoRuxing Dec 14, 20098:30:53 PM
 * @version 1.0
 */
public class DelUserRole extends ComponentBase{

	public DelUserRole(UserInfo user, String homeUrl, String recordId,
			KvMap<String, String> params) {
		super(user, homeUrl, recordId, params);
	}

	/**
	 * @return 删除用户角色提示信息
	 * @throws ErrorMessage 
	 */
	public HtmlWindow get() throws ErrorMessage{
		Confirm delete = new Confirm("确定删除用户角色"+""+"?",recordId, null);
		delete.bind(UserManage.User_Role_Del_Submit);
		return delete.get();
	}
	
	/**
	 * 删除用户角色操作
	 * @return 刷新脚本
	 * @throws ErrorMessage 
	 */
	public HtmlWindow submit() throws ErrorMessage{
		//删除用户角色操作
		String userRoleId = recordId;
		UserManageBean userManage = UserManageBean.getNewInstance(mUser.getUserID());
		userManage.delUserRole(userRoleId, false);
		//返回刷新脚本
		HtmlWindow win = new HtmlDiv();
		win.bind(AjxScript.getA(UserBase.conId, UserManage.User_Base_Info));
		return win;
	}
}
